/**
 * Created by DukeCrushIt on 2015/8/4.
 */
class PetShopScene extends eui.Component{
    // private shopItemRenderFac:eui.ClassFactory;
    private remindAsset:eui.Image;
    public constructor(){
        super();
        this.skinName = "skins.simple.SkinnableContainerSkin";
        this.shopList = new eui.List();
        // this.shopList.skinName = "skins.simple.ListSkin";
        this.shopList.width = 460;
        this.shopList.height = 550;
        this.shopList.y = 30;
        // this.shopItemRenderFac =  new eui.ClassFactory(ShopItemRender);
        this.addChild(this.shopList);
        this.remindAsset = new eui.Image();
        this.remindAsset.source = "resource/assets/produce/instruct_shop.png";
        this.remindAsset.cacheAsBitmap = true;
        this.remindAsset.x = 40;
        this.addChild(this.remindAsset);
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.addedToStage, this);
        this.x = 5;
    }

    private addedToStage(evt:egret.Event){
        // var tskin = this.shopList.skin;
        // var scroller:eui.Scroller = tskin._elementsContent[0];
        // if( scroller != null)
        //     scroller.verticalScrollPolicy = Model.GuideType != null ? "off" : "on";
        // if( !Model.goodsSorted){
        //     this.shopList.itemRenderer = this.shopItemRenderFac;
        //     if( !Model.goodsSorted){
        //         var iamcat:boolean = Model.me.myType == Model.GOOD_TYPE_CAT;
        //         Model.goods.sort(function(item0,item1):number{
        //             if( item0.orders != item1.orders){
        //                 return item0.orders> item1.orders ? -1 : 1;
        //             }else if( (item0.use4Cat === iamcat && item1.use4Cat === iamcat) || (item0.use4Cat !== iamcat && item1.use4Cat !== iamcat)){
        //                 return item0.id < item1.id ? 1 : -1;
        //             }else if(item0.use4Cat === iamcat){
        //                 return -1;
        //             }else{
        //                 return 1;
        //             }
        //         });
        //         Model.goodsSorted = true;
        //         this.shopList.dataProvider = new eui.ArrayCollection(Model.goods);
        //     }
        // }
    }
    private shopList:eui.List;

    private static _instance:PetShopScene;
    public static getInstance():PetShopScene{
        if( PetShopScene._instance == null )
            PetShopScene._instance = new PetShopScene();
        return PetShopScene._instance;
    }
}